home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_08 / saks / armexamp.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-06  |  477 b   |  23 lines

  1. Listing 2 - The ARM's example illustrating restrictions on 
  2. member functions in local classes
  3.  
  4. int x;
  5. void f()
  6. {
  7.     static int s ;
  8.     int x;
  9.     extern int g();
  10.  
  11.     struct local {
  12.         int g() { return x; }   // error:
  13.                                 // 'x' is auto
  14.         int h() { return s; }   // ok
  15.         int k() { return ::x; } // ok
  16.         int l() { return g(); } // ok
  17.     };
  18.     // ...
  19. }
  20.  
  21. local* p = 0;   // error: 'local' not in scope
  22.  
  23.